package d4_map;

import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;

/**
 * 2024/6/6  Cjr 掌握Map集合的特点 17：55
 */
public class MapTest1 {
    public static void main(String[] args) {

        //Map  无序 不可重复 无索引
        Map<String,Object> map=new HashMap<>();
        map.put("小米",1);
        map.put("小红",2);
        map.put("小米",1);
        System.out.println(map);

        //LinkedHashMap 有序 不可重复 无索引
        Map<String,String> linkedHashMap=new HashMap<>();
        linkedHashMap.put("张安","睡觉");
        linkedHashMap.put("小明","吃饭");
        linkedHashMap.put("小明","吃饭");
        System.out.println(linkedHashMap);

        //3.TreeMap 升序排序 不可重复 无索引
        Map<Integer,String> treeMap=new TreeMap<>();
        treeMap.put(2,"张三");
        treeMap.put(1,"王五");
        treeMap.put(3,"小张");
        treeMap.put(4,"王山");
        treeMap.put(5,"小李");
        treeMap.put(7,"李白");
        System.out.println(treeMap);
    }
}
